< previous page page_34 next page >

Page 34
0034-01.jpg
Figure 2.13.
Adding the DATETIME data type to the form.
How does Visual Basic decide what date format to use? The date format used comes from the settings in the Windows 95 Control Panel Regional Settings applet. While you have this program running, experiment by calling up the Windows 95 Regional Settings applet. (From the task bar, select Start | Settings | Control Panel, and then select Regional Settings.) Change the date format settings, and return to your Visual Basic program to see the results.
Tip.gif
The Visual Basic DATETIME data type should always be used to store date values. If you install your program in Europe, where the common date display format is DD-MM-YY instead of the common U.S. format of MM-DD-YY, your program will work without a problem. If you store dates as strings in the format MM/DD/YY or as numeric values in the format YYMMDD, your program will not be able to compute or display dates correctly across international boundaries.

Testing the COUNTER Data Type
Now let's test a very special database field typethe COUNTER data type. This data type is automatically set by Visual Basic each time you add a new record to the data table. The COUNTER data type makes an excellent unique primary key field because Visual Basic is able to create and store more than a billion unique values in the COUNTER field without duplication.
Note.gif
Actually, the Counter data type is not a true database field type. Instead, the Counter data type is a Long data field with its Attribute property set to AutoIncrField. You won't find the Counter data type listed in the documentation, but you will see references to auto-incrementing fields and see a "Counter" type as an option when you build data fields with the Visual Data Manager.

 
< previous page page_34 next page >

If you like this book, buy it!